package com.serie402.business.command.events;

import org.apache.log4j.Logger;

import com.kiss.fw.command.AbstractCommand;
import com.kiss.fw.dto.AbstractDTO;
import com.kiss.fw.exceptions.CommandException;
import com.kiss.fw.exceptions.CommandInitializeException;
import com.serie402.business.dao.EventsDAO;
import com.serie402.business.dao.dto.EventDAODTO;

public class CreateEventCmd extends AbstractCommand {
	private static final Logger logger = Logger.getLogger(CreateEventCmd.class);
	private static EventsDAO dao;
	
	@Override
	protected void initialize () throws CommandInitializeException {
		dao = EventsDAO.getInstance();
	}
	
	@Override
	protected void authorize (AbstractDTO _dto) throws SecurityException {
	}
	
	@Override
	protected void preProcess (AbstractDTO _dto) throws CommandException {
	}
	
	@Override
	protected void process (AbstractDTO _dto) throws CommandException {
		EventDAODTO daoDto = new EventDAODTO();
		
		try {
			dao.create(daoDto);
		}
		catch(Exception _exception) {
			handleException(logger, "process() - Error", _exception);
		}
	}
	
	@Override
	protected void postProcess (AbstractDTO _dto) throws CommandException {
	}
}